<template>
    <div>
        <input type="button" value="导出" @click="daochu" class="btn btn-warning"/>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>房号名称</td>
                    <td>门店名称</td>
                    <td>房型</td>
                    <td>房态</td>
                    <td>操作</td>
                </tr>
                <tr v-for="item in data.list" :key="item.Id">
                    <td>{{ item.HouseName }}</td>
                    <td>{{ item.ShopName }}</td>
                    <td>{{ item.HouseTypeName }}</td>
                    <td>
                        <span v-if="item.HouseState==1">空闲</span>
                        <span v-if="item.HouseState==2">已入住</span>
                        <span v-if="item.HouseState==3">已预约</span>
                    </td>
                    <td>操作</td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import {ref,reactive, onMounted}from 'vue';
import axios from 'axios';
import moment from 'moment';
import {useRouter,useRoute}from 'vue-router'
const router=useRouter();
const route=useRoute();

let data:any=reactive({
    list:[]
})

let queryinfo=reactive({
    pageindex:1,
    pagesize:20,
    houseName:""
})

onMounted(()=>{
    getlist();
})

const daochu=()=>{
    location.href=`https://localhost:7178/api/House/ExPorExcel?housename=${queryinfo.houseName}`;
}

const getlist=()=>{
    axios({
        url:'/api/House/GetListNo',
        method:'get',
        params:queryinfo
    })
    .then(res=>{
        console.log(res);
        data.list=res.data;
    })
    .catch(err=>{
        console.log(err);
    })
}

</script>

<style scoped></style>